<template>
  <div>
    <div class="item" v-for="(item, index) of list" :key="index">
      <div class="item-title border-bottom">
        <span class="item-title-icon"></span>
        {{item.title}}
      </div>
      <div v-if="item.children">
        <detail-list :list="item.children" class="item-chilren"></detail-list> <!-- 递归复用组件 -->
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'DetailList',
  props: {
    list: Array
  }
}
</script>

<style lang="stylus" scoped>
  .item-title
    line-height .8rem
    font-size .32rem
    padding .2rem // 内边距
    .item-title-icon
      position relative
      top .09rem
      left .1rem
      display: inline-block;
      width: .26rem;
      height: .32rem;
      background: url(http://ss.qunarzz.com/package_b2c_frontend/detail/detail-icov10.png) no-repeat -312px 0;
      margin-right: .2rem;
      // background-size .4rem .3rem // 设置背景图像的高度和宽度。第一个值设置宽度，第二个值设置高度。
  .item-chilren
    padding 0 .3rem
</style>
